
<%
/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */
%>

<%@include file="/init.jsp"%>
<%@ taglib uri="http://alloy.liferay.com/tld/aui" prefix="aui"%>
<%@taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui"%>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<style>
#refreshCaptchaActivity {
width: 32px;
height: 26px;
}
.taglib-captcha {
float: left;
}
.btn {
margin-top: 86px;
}
</style>
<%

String strCaptchaResult=ParamUtil.getString(renderRequest, "captchaResult");
String AlertMsg=ParamUtil.getString(renderRequest, "msg-send-successfully");;
String strFullName=ParamUtil.getString(renderRequest, "FullName");
String strEmail=ParamUtil.getString(renderRequest, "strEmail");
String strAddress=ParamUtil.getString(renderRequest, "strAddress");
String strContact=ParamUtil.getString(renderRequest, "strContact");
String strPurpose=ParamUtil.getString(renderRequest, "strPurpose");

Group group = GroupLocalServiceUtil.getGroup(scopeGroupId);

Organization organization = null;
User user2 = null;

if (group.isOrganization()) {
	organization = OrganizationLocalServiceUtil.getOrganization(group.getClassPK());
}
else if (group.isUser()) {
	user2 = UserLocalServiceUtil.getUserById(group.getClassPK());
	System.out.println("this is userid"+user2.getUserId());
}
%>
<portlet:actionURL name="oa" var="oaurl">
</portlet:actionURL>
<aui:form action="<%=oaurl.toString()%>" name="frmoa" method="post">
	<%if(group.isUser()){ %>
	<tr>
		<td>
			<h3>
				You can contact Dr.<b> <%=user2.getFullName()%></b> by filling this
				form. <br> He will get this detail by email and reply soon....
			</h3>
		</td>
	</tr>
	<%} %>
	<%
if(AlertMsg!=null && AlertMsg.equalsIgnoreCase("Yes"))
    {
	%>
	<liferay-ui:success key="success"
		message="Your Appointment has been sent succesfully"></liferay-ui:success>

	<% }%>
	<tr>

		<aui:fieldset>
			<aui:layout>
				<aui:column columnWidth="25">
					<aui:input inlineLabel="true" label="Your Name" name="YourName"
						type="text">
						<aui:validator name="alpha" />
					</aui:input>
				</aui:column>
			</aui:layout>
			<aui:layout>
				<aui:column columnWidth="25">
					<aui:input inlineLabel="true" label="Email Id" name="EmailId"
						type="text">
						<aui:validator name="email" />
					</aui:input>
				</aui:column>
			</aui:layout>
			<aui:layout>
				<aui:column columnWidth="25">
					<aui:input inlineLabel="true" label="Address" name="Address"
						type="text" />
				</aui:column>
			</aui:layout>
			<aui:layout>
				<aui:column columnWidth="25">
					<aui:input inlineLabel="true" label="Mobile No" name="MobileNo"
						type="text">
						<aui:validator name="digits" />
					</aui:input>
				</aui:column>
			</aui:layout>
			<aui:layout>
				<aui:column columnWidth="25">
					<aui:input inlineLabel="true" label="Your Purpose" name="Purpose"
						type="textarea" />
				</aui:column>
			</aui:layout>
						
			<div>
			<portlet:resourceURL var="captchaURL" />
				<liferay-ui:captcha url="<%=captchaURL%>" />
				<div style="padding: 23px 0 0 5px; cursor: pointer;">
					<img id="refreshCaptchaActivity"
						src="<%= request.getContextPath()%>/refresh.png">
				</div>
			</div>
			<%
System.out.println("strCaptchaResult in Jsp=="+strCaptchaResult);
 if (strCaptchaResult.equalsIgnoreCase("Invalid"))
    {
         System.out.println("strCaptchaResult in Jsp1111=="+strCaptchaResult);
%>

                               <tr>
                                       <td class="portlet-msg-error">Please enter correct code.</td>
                               </tr>
                               <%}%>
			<div class="btn">
			<aui:input name="hdn" type="hidden" value="<%=user2.getUserId() %>"></aui:input>
			
			<aui:button type="submit" value="Send Mail"></aui:button>
			</div>
		</aui:fieldset>
</aui:form>

<script>
jQuery("#refreshCaptchaActivity").click(function()
		{
	
	jQuery(".captcha").attr("src", jQuery(".captcha").attr("src")+"&force=" + new Date().getMilliseconds());
	return false;
		});
</script>